import axios from '@/static/js/axios'
import message from '@/static/js/message';

export default{
    //获取授权菜单
    getMenu: () => {
        return axios.get('/oa/User/menuAuth')
        .then(res=>{
            let { code, msg, data } = res;
            if(code != 1){
                return message.error(msg);
            }else{
                return data
            }
        })
    },

    //获取数据字典
    getConfigData: () => {
        return axios.get('/oa/config/index')
        .then(res=> {
            let { code, msg, data } = res;
            if(code != 1){
                return message.error(msg);
            }else{
                return data
            }
        })
    },

    //获取部门
    getDep: () => {
        return axios.get('/oa/Department/index',{is_page: 0})
        .then(res=> {
            let { code, msg, data } = res;
            if(code != 1){
                return message.error(msg);
            }else{
                return data
            }
        })
    },

    //获取角色
    getGroup: () => {
        return axios.get('/oa/Group/index',{is_page: 0})
        .then(res=> {
            let { code, msg, data } = res;
            if(code != 1){
                return message.error(msg);
            }else{
                return data
            }
        })
    },

    //获取用户
    getUser: () => {
        return axios.get('/oa/user/index',{is_page: 0})
        .then(res=> {
            let { code, msg, data } = res;
            if(code != 1){
                return message.error(msg);
            }else{
                return data
            }
        })
    }
}